<div class="container container-gary">
    <!-- member index -->
    <div class="m-ptb wrap clearfix">
{include file="common@public/_personal_left"}
          <div class="member-right">
              <div class="member-sign clearfix">
                  <b>我的信息</b>
                  <div class="address-span">
                    <input class="address-s-color" type="button" value="保存" id="but"/>
                    <a href="javascript:history.back(-1)"><input type="button" value="取消"/></a>
                 </div>
              </div>
              <div class="member-order min-height">
                  <div class="member-t-gary clearfix">
                      <h3>我的资料</h3>
                  </div>
                  <div class="m-safe-info">
                      <div class="m-safe-enter clearfix" hidden="hidden">
                          <div class="m-safe-txt">账户信息：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="输入用户名" value="{$info.user_name}" id="username"/>
                              <span id="user" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">手机号：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="输入手机号码" value="{$info.mobile}" id="mobile"/>
                              <span id="phone" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">邮箱：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="输入邮箱" value="{$info.email}" id="email"/>
                              <span id="uemail" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">QQ：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="输入QQ号码" value="{$info.qq}" id="qq"/>
                              <span id="uqq" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">联系人：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="输入联系人" value="{$info.name}" id="name"/>
                              <span id="uname" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                      <div class="m-safe-enter clearfix">
                          <div class="m-safe-txt">联系人手机号：</div>
                          <div class="m-safe-right">
                              <input class="safe-input safe-w1" type="text" placeholder="输入联系人手机号码" value="{$info.l_mobile}" id="lmobile"/>
                              <span id="uphone" style="color: red" class="enter-prompt"></span>
                          </div>
                      </div>
                  </div>
              </div>
          </div>
      </div>

  </div>

  <!-- footer -->
  <!--#include file="includes/foot.html"-->

<!-- menu -->
  <script type="text/javascript" src="/public/static/home/js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="/public/static/home/js/menu.js"></script>
<script src="/public/static/home/js/icheck.js"></script>
<script>
    $('#username').blur(function() {
        $("#user").text("");
    });
    $('#mobile').blur(function() {
        $("#phone").text("");
    });
    $('#email').blur(function() {
        $("#uemail").text("");
    });
    $('#qq').blur(function() {
        $("#uqq").text("");
    });
    $('#name').blur(function() {
        $("#uname").text("");
    });
    $('#lmobile').blur(function() {
        $("#uphone").text("");
    });

    $('#but').click(function(){
        var username=$('#username').val();
        var moblie=$('#mobile').val();
        var email=$('#email').val();
        var qq=$('#qq').val();
        var name=$('#name').val();
        var lmobile=$('#lmobile').val();
//       if(username=='' || username==' '){
//          $('#user').text('用户账号不能为空');
//           document.getElementById('username').focus();
//           return false;
       if(moblie=='' || moblie==' '){
           $('#phone').text('手机号码不能为空');
           document.getElementById('mobile').focus();
           return false;
       }else if(email=='' || email==' '){
           $('#uemail').text('邮箱不能为空');
           document.getElementById('email').focus();
           return false;
       }else if(qq=='' || qq==' '){
           $('#uqq').text('输入QQ号码');
           document.getElementById('qq').focus();
           return false;
       }else if(name=='' || name==' '){
           $('#uname').text('联系人不能为空');
           document.getElementById('name').focus();
           return false;
       }else if(lmobile=='' || lmobile==' '){
           $('#uphone').text('请输入联系人手机号');
           document.getElementById('lmobile').focus();
           return false;
       }else{
           $.ajax({
               url:"{:url('member/Memberinfo/editInfo')}",
               type:"post",
               data:{'username':username,'moblie':moblie,'email':email,'qq':qq,'name':name,'lmobile':lmobile},
               success:function (data) {
                  if(data==1){
                      $('#phone').text('手机号码格式不正确');
                      document.getElementById('mobile').focus();
                      return false;
                  }else if(data==2){
                      $('#uphone').text('联系人手机号码格式不正确');
                      document.getElementById('lmobile').focus();
                      return false;
                  }else if(data==3){
                      $('#uemail').text('邮箱格式不正确');
                      document.getElementById('email').focus();
                      return false;
                  }else if(data==4){
                      window.location.href="{:url('member/Memberinfo/index')}";
                  }else{
                      $('#uemail').text('修改信息失败');
                      document.getElementById('email').focus();
                      return false;
                  }
               }
           });
       }

    });

    $(function(){
      //top select
      $(".top-select").mouseover(function () {
        $(".top-s-text").show();
      })
      $(".top-select").mouseout(function () {
        $(".top-s-text").hide();
      })
      $(".top-s-text div").click(function () {
        var selecttext = $(this).text();
        $(".top-s-head span").text(selecttext);
        $(this).parent(".top-s-text").hide()
      })
      // top code
      var turn = function(target,time,opts){
      target.find('.top-code').hover(function () {
            $(this).find('.top-c-img').stop().animate(opts[0], time, function () {
			$(this).hide().next().show();
			$(this).next().animate(opts[1],time);
	   });
	   },function(){
	        $(this).find('.top-c-text').animate(opts[0], time, function () {
			    $(this).hide().prev().show();
			    $(this).prev().animate(opts[1],time);
		 });
	     });
        }
        var verticalOpts = [{'width':0},{'width':'80px'}];
        turn($('.top-right'), 150, verticalOpts);
        //menu all
        $(".menu-all div").mouseenter(function () {
            $(this).addClass("current");
            $(".submenu").show();
        })
       $(".menu-all div").mouseleave(function () {
            $(this).removeClass("current");
            $(".submenu").hide();
        })
        $(".submenu").mouseenter(function(){
           $(this).show();
           $(".menu-all div").addClass("current")
        })
        $(".submenu").mouseleave(function(){
           $(this).hide();
           $(".menu-all div").removeClass("current")
        })
        //left submenu
        $(".submenu ul li").each(function () {
            var $this = $(this);
            var $children = $this.find('.submenu-pro');
            var $otherChildren = $this.siblings('li').find('.submenu-pro');
            var $childrenList = $children.children('.submenu-total');
            $this.on({
                'mouseenter': function () {
                    $children.css({ 'display': 'block', 'width': 221 * parseInt($childrenList.size()) });
                    $otherChildren.css('display', 'none');
                },
                'mouseleave': function () {
                    $children.css('display', 'none');
                }
            })
        });

        //member left
        $(".member-l-title").click(function(){
           $(this).parent(".member-l-list").toggleClass("m-current");
           $(this).parent(".member-l-list").find("ul").slideToggle()
        })
    })
</script>
</body>
</html>